#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <list>

#include <algorithm>

using namespace std;

int main()
{
	list<int> lt = { 1,2,3,6,4 ,2,3};

	list<int>::iterator it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.sort();

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.sort(greater<int>());

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.unique();

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	auto pos = find(lt.begin(), lt.end(), 2);
	lt.splice(lt.begin(), lt, pos);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.reverse();

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.remove(2);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}